#ifdef _SYMBIAN_SDK_
#include "./symApp.h"
#include "./symWindow.h"
namespace Sky
	{
		TBool symApp::Initialise(Handler::Handle proc)
		{
			myApplication::Initialise(proc);
		
			myWinletPtr p;
			p = skynew (symWindow());
			p->incRef();
			getWindowManager()->attachFirst(p);
			p->Create(0,0,240,320,getResManager());
		
			MessagePtr createEvent;
			createEvent = skynew (myWinMsg(&myWinlet::handleCreated,this));
			p->handleSendEvent(getEventManager(),createEvent);
		
			createEvent = skynew (myWinMsg(&myWinlet::handleUIEvent,this));
			p->handleSendEvent(getEventManager(),createEvent);
			return vTrue;
		}
		
		Void symApp::Finalise()
		{
			myWinlet* p;
			p = getWindowManager()->detachFirst();
			MessagePtr deleteEvent ;
			deleteEvent = skynew (myWinMsg(&myWinlet::handleDeleting,this));
			while(p)
			{
				p->handleSendEvent(getEventManager(),deleteEvent);
				p->decRef();
				p = getWindowManager()->detachFirst();
			}
			getWindowManager()->detachAll();
			myApplication::Finalise();
		}
		
		Sky::NValue::MsgStatus xhandleSendEvent( symAppPtr app,Msg* event )
		{
			xAssert(app);
			return app->handleSendEvent(app->getEventManager(),event);
		}
		
		Sky::NValue::MsgStatus xhandlePostEvent( symAppPtr& app,Msg* event )
		{
			xAssert(app);
			return app->handlePostEvent(app->getEventManager(),event);
		}
		
		Sky::NValue::MsgStatus xonNetworkEvent( symAppPtr& app,Void* data,TInt size )
		{
			xAssert(app);
			//app->getNetMessager()->recv(data,size);
			return vContinue;
		}
		
		//TVoid xDelete( symAppPtr& app )
		//{
		//	xAssert(app);
		//	myDELETE(app);
		//	return;
		//}
		
		Sky::symAppPtr Sky::xCreate()
		{
			return skynew (symApp());
		}
	}
#endif